package com.linkoog.devtools.install_plugin_locally;

import com.intellij.ide.plugins.PluginManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.extensions.PluginDescriptor;
import com.linkoog.devtools.utils.ExplorerHolder;
import org.jetbrains.annotations.NotNull;

import java.nio.file.Path;

/**
 *   打开插件的安装目录
 */
public class OpenPluginFolderAction extends AnAction {

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
        PluginDescriptor pluginDescriptor = PluginManager.getPluginByClass(OpenPluginFolderAction.class);
        if (pluginDescriptor == null) return;

        Path installPath = pluginDescriptor.getPluginPath();
        if (installPath == null) return;

        ExplorerHolder.openFile(installPath.getParent());
    }



}
